<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/base.jsp"%>
<%@ include file="/module/taglibs.jsp"%>
<%@ include file="/module/nocache.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>项目管理</title>
<%@ include file="/module/js.jsp"%>
<script type="text/javascript">
$(document)
.ready(
		function() {
			$('#dg').datagrid({
			 /*onSortColumn :function(sort,order){
			   var _sort=sort;
			   var _order=order;
			   var options=$('#dg').datagrid('getPager').data("pagination").options;
			   var page=options.pageNumber;
			   var pageSize=options.pageSize;
			   //alert(page+"==="+pageSize);
			   window.setTimeout(function(){
				   $.post("${basePath}/semesterSummary/semesterSummaryManagerList",{orderFlag:_order,orderField:_sort,
					   semid: $('#semid').val(),
					   xh:$('#xh').val(),
					   xm :$("#xh").val(),
					   njid:$('#njid').val(),
					   zyid :$('#zyid').val(),
					   bjid :$('#bjid').val(),
					   bzr :$('#ismanager').val()
					   },function(data){
							  $('#dg').datagrid("loadData",data); 
						   });
				 },100);  
			   },*/
			   rowStyler: function(index,row){
			   }
			});
			
			//查询
			$('#btnQuery').click(function() {
			  $('#dg').datagrid('load',{
				  semid: $('#semid').val(),
				  xh:$('#xh').val(),
				  xm :$("#xh").val(),
				  njid:$('#njid').val(),
				  zyid :$('#zyid').val(),
				  bjid :$('#bjid').val(),
				  bzr :$('#ismanager').val()
			  });
			});
			//新增
			$('#btnAdd').click(function() {
			  document.semesterForm.action = "${basePath}/semesterSummary/addSemesterSummaryManagerForward";
			  document.semesterForm.submit();
			});
			
			//删除
			$('#btnDelete').click(function() {
			    $("#idList").val("");
			    var count = 0;		
				var idList = new Array();
			    var sels = $("#dg").datagrid("getSelections");
			    for(var i in sels){
				   idList.push(sels[i].zjid);
					count++;
			    }
			  if (count == 0) {
				layer.alert("您至少选择一条删除记录信息", {icon: 3});
				return false;
				}else{
					  layer.confirm("您是否删除当前选中数据信息", {icon: 3, title:'提示',skin:'layer-ext-moon'}, function(index){
						    $("#idList").val(idList);
						    document.semesterForm.action = "${basePath}/semesterSummary/removeManagerSemesterSummary";
							document.semesterForm.submit();
					  },function(index){
							layer.close(index);
					  });
				}
			});
			$('#btnExport').on('click', function(){
				   layer.confirm("您确定要导出吗?", {icon: 3, title:'提示',skin:'layer-ext-moon'}, function(index){
					 //  var rows = $("#dg").datagrid("getRows");
					  // var bodyData = JSON.stringify(rows);  //转成json字符串
					 //   $("#bodyData").val(JSON.stringify(rows));
							document.semesterForm.action = "${basePath}/semesterSummary/exportManagerSemesterSummary";
							document.semesterForm.submit();
            		 });
				});
		});

/**
 * 添加超链接
 * @param value
 * @param row
 * @param index
 * @returns {String}
 */
function formaterLink(value, row, index) {
    return "<a href='${basePath}/semesterSummary/modiftySemesterSummaryManagerForward?zjid=" + row.zjid + "&ismanager="+$("#ismanager").val()+"'>" + value + "</a>";
}

</script>


</head>
<body>
	<form action="#" name="semesterForm" id="semesterForm" method="post">
	  <input type="hidden" id="idList" name="idList" value=""/>
	  <input  type="hidden" id="ismanager" name="ismanager" value="${ismanager}"/>
<!-- 	  <input type="hidden" id="bodyData" name="bodyData" value=""/> -->
		<table cellpadding="1" cellspacing="1" border="0">
		<c:choose>
		 <c:when test="${_login_user_type==2}">
		 <td><input type="button" id="btnQuery" autocomplete="off"  value="查询"
					class="inputButton" /></td>
		  <c:if test="${ismanager==1}">
	   <kl:permission permisstionList="${permisstionList}" currentUser="${_login_console_user}" currentCatalogId="<%=CatalogUtils.getCatalogId(\"XGGL_QMPB_QMZJ_BZR\")%>" key="add"> 
			<td><input type="button" id="btnAdd" autocomplete="off"  value="添 加"
				class="inputButton" /></td>
		</kl:permission> 
		 	<kl:permission permisstionList="${permisstionList}" currentUser="${_login_console_user}" currentCatalogId="<%=CatalogUtils.getCatalogId(\"XGGL_QMPB_QMZJ_BZR\")%>" key="delete">
				<td><input type="button" id="btnDelete" autocomplete="off"  value="删除"
					 class="inputButton"/></td>
			</kl:permission> 
		  </c:if>
		  <td><input type="button" id="btnExport" autocomplete="off"  value="导出"
					 class="inputButton"/></td>
		 </c:when>
		 <c:otherwise>
		  <td><input type="button" id="btnQuery" autocomplete="off"  value="查询"
					class="inputButton" /></td>
		 	<td><input type="button" id="btnExport" autocomplete="off"  value="导出"
					 class="inputButton"/></td>
		 </c:otherwise>
	
		</c:choose>
		</table>
		<table cellpadding="1" cellspacing="1">
			<tr>
				<td>学期：</td>
				<td>
				<select id="semid" name="semid" class="selectList2">
				 <option value="">全部</option>
				 <c:forEach items="${semesterList}" var="semester">
				 <option value="${semester.xqid}">${semester.xqmc}</option>
				 </c:forEach>
				</select>
			</td>
			<td>学号：</td>
			<td><input type="text" id="xh" name="xh" value="" autocomplete="off" class="inputText2"/></td>
			<td>姓名：</td>
			<td><input type="text" id="xm" name="xm" value="" autocomplete="off" class="inputText2"/></td>
			</tr>
			<%@ include file="/module/gradeSpecityByClass.jsp"%>
<!-- 			<tr> -->
<!-- 			 <td>年级：</td> -->
<!-- 			<td><select id="njid" name="njid" class="selectList" onchange="javascript:getSpecailityByClass('njid','zyid','bjid')"> -->
<%-- 			  <c:forEach items="${gradeList}" var="grade"> --%>
<%-- 			   <option value="${grade.njid}">${grade.njmc}</option> --%>
<%-- 			  </c:forEach> --%>
<!-- 			</select> -->
<!-- 			</td> -->
<!-- 			<td>专业：</td> -->
<!-- 			<td><select id="zyid" name="zyid" class="selectList" onchange="javascript:getSpecailityByClass('njid','zyid','bjid')"> -->
<!-- 			 <option value="">全部</option> -->
<%-- 			 <c:forEach items="${specialityList}" var="speciality"> --%>
<%-- 			 <option value="${speciality.zyid}">${speciality.zymc}</option> --%>
<%-- 			 </c:forEach> --%>
<!-- 			</select> -->
<!-- 			</td> -->
<!-- 			<td>班级：</td> -->
<!-- 			<td><select id="bjid" name="bjid" class="selectList"> -->
<!-- 			<option value="">全部</option> -->
<%-- 			<c:forEach items="${classList}" var="class"> --%>
<%-- 			 <option value="${calss.bjid}">${class.bjmc}</option> --%>
<%-- 			</c:forEach> --%>
<!-- 			</select> -->
<!-- 			</td> -->
<!-- 			</tr> -->
		</table>
		<br/>
     <table id="dg"  style="width:85%;"
		data-options="pagination:true,collapsible:true,url:'${basePath}/semesterSummary/semesterSummaryManagerList?bzr=${ismanager}',method:'post',remoteSort:true,striped:true">
		<thead>
			<tr>
<!-- 				<th data-options="field:'zjid',checkbox:true,width:100,align:'center'"></th> -->
				<th data-options="field:'xm',sortable:true,nowrap:true,width:200,align:'center',formatter:formaterLink">姓名</th>
				<th data-options="field:'xh',sortable:true,nowrap:true,width:200,align:'center'">学号</th>
				<th data-options="field:'xqmc',sortable:true,nowrap:true,width:200,align:'center'">学期</th>
				<th data-options="field:'hdry',nowrap:true,width:300,align:'center',sortable:true">本学期取得的荣誉</th>
				<th data-options="field:'sqxm',nowrap:true,width:300,align:'center',sortable:true">本学期申请的先进项目</th>
			</tr>
		</thead>
	</table>
		<script type="text/javascript">
			 if("${msg}"!=""){
			       layer.alert("${msg}", {icon: 6});
			  } 
			 compareListValue(document.getElementById('semid'),'${semester.xqid}');
			 
		</script>
	</form>
</body>
</html>
